Option Strict Off
Option Explicit On
Friend Class listabuscar
	Inherits System.Windows.Forms.Form
	
	'UPGRADE_WARNING: Form event listabuscar.Activate has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
	Private Sub listabuscar_Activated(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Activated
		'Activar
		nombreform = Me.Name
	End Sub
	Private Sub listabuscar_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Dim NewLargeChange As Short
		Dim explode() As String
		Dim explode1() As String
		Dim i, j As Integer
		Dim nombre, aux As String
		Dim latitud, band, cod, longitud As String
		Dim sql As String
		Dim aux2 As Integer
		
		i = 0 : j = 0
		explode = Split(cadParametros, "*")
		For i = LBound(explode) To UBound(explode)
			
			explode1 = Split(explode(i), ",")
			'UPGRADE_WARNING: Couldn't resolve default property of object devolverCod(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			cod = devolverCod(" cod_protocolo as cod", "protocolo", "nro_reg='" & explode1(1) & "'", 0)
			'UPGRADE_WARNING: Couldn't resolve default property of object devolverCod(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			sql = devolverCod(" cod_coordenadas as cod", "datos_muestra", "cod_protocolo=" & cod, 0)
			If sql <> "" Then
				'UPGRADE_WARNING: Couldn't resolve default property of object devolverCod(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				latitud = devolverCod(" latitud as cod", "coordenadas", "cod_coordenadas=" & sql, 0)
				'UPGRADE_WARNING: Couldn't resolve default property of object devolverCod(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				longitud = devolverCod(" longitud as cod", "coordenadas", "cod_coordenadas=" & sql, 0)
			Else
				latitud = "" : longitud = ""
			End If
			'mostrar datos
			If (j = 0) Then
				chk_especial(j).Text = explode1(0) : chk_especial(j).Visible = True
				lbl_reg(j).Text = explode1(1) : lbl_reg(j).Visible = True
				lbl_lab(j).Text = explode1(2) : lbl_lab(j).Visible = False 'True
				lbl_coorde(j).Text = latitud & "  " & longitud : lbl_coorde(j).Visible = True
			Else
				chk_especial.Load(j) 'Incrementa el numero de elementos que requiere
				chk_especial(j).Text = explode1(0)
				chk_especial(j).Top = VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(chk_especial(j - 1).Top) + 270)
				chk_especial(j).Visible = True
				lbl_reg.Load(j)
				lbl_reg(j).Text = explode1(1)
				lbl_reg(j).Top = VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(lbl_reg(j - 1).Top) + 270)
				lbl_reg(j).Visible = True
				'-----
				lbl_lab.Load(j)
				lbl_lab(j).Text = explode1(2)
				lbl_lab(j).Top = VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(lbl_lab(j - 1).Top) + 270)
				lbl_lab(j).Visible = False 'True
				lbl_coorde.Load(j)
				lbl_coorde(j).Text = latitud & "  " & longitud
				lbl_coorde(j).Top = VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(lbl_coorde(j - 1).Top) + 270)
				lbl_coorde(j).Visible = True
				'---
			End If
			
			j = j + 1
		Next i
		band = CStr(i) 'numero de checkbox
		'si es vacio enviar mensaje y cerrar form
		
		
		bandProtocolo = i
		'/---- VSCROLL FORM
		' establece el hook para interceptar la rueda del mouse
		Hook(vsb)
		'Inicializa los scrolbar (los posiciona y le da los valores max y Largchange )
		Call EstablecerScrollBar("listabuscar")
		vsb.Top = 0
		'vsb.LargeChange = 50
		'vsb.SmallChange = 25
		NewLargeChange = 50
		vsb.Maximum = vsb.Maximum + NewLargeChange - vsb.LargeChange
		vsb.LargeChange = NewLargeChange
		vsb.SmallChange = 150 '25
		'el maximo del scroll
		If j = 1 Then
			vsb.Maximum = (1 + vsb.LargeChange - 1)
		Else
			If chk_especial.Count <= 10 Then
				j = 1
			Else
				frm_2.Height = VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(chk_especial(j - 1).Top) + 150) '+ 300 'COLUMNAS
				j = VB6.PixelsToTwipsY(frm_2.Height)
			End If
			vsb.Maximum = (j + vsb.LargeChange - 1) 'frm_2.Height '25970
		End If
		
		frm_2.BorderStyle = System.Windows.Forms.BorderStyle.None
		
	End Sub
	
	'UPGRADE_NOTE: vsb.Change was changed from an event to a procedure. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="4E2DC008-5EDA-4547-8317-C9316952674F"'
	'UPGRADE_WARNING: VScrollBar event vsb.Change has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
	Private Sub vsb_Change(ByVal newScrollValue As Integer)
		If newScrollValue = 0 Then
			frm_1.SetBounds(0, 0, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
		Else
			frm_1.Top = VB6.TwipsToPixelsY(-newScrollValue)
		End If
	End Sub
	Private Sub cmdAcept_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdAcept.Click
		Dim u, i, j, band As Integer
		Dim cad As String
		band = bandProtocolo
		'**** capturar los checkbox seleccionados
		For i = 0 To band - 1
			If chk_especial(i).CheckState = 1 Then
				'codigoEspecialFisi
				If (j = 0) Then
					'UPGRADE_WARNING: Couldn't resolve default property of object devolverCod(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					cad = devolverCod(" cod_protocolo as cod", "protocolo", "nro_reg='" & lbl_reg(i).Text & "'", 0)
					'cad = lbl_reg(i).Caption:
					j = j + 1
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object devolverCod(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					cad = cad & "*" + devolverCod(" cod_protocolo as cod", "protocolo", "nro_reg='" & lbl_reg(i).Text & "'", 0)
					'lbl_reg(i).Caption
				End If
				u = 1
				'Else
				'u = 0
			End If
		Next i
		cadParametros = cad
		
		If u = 1 Then 'si selecciono uno por lo menos
			tickel1.Show()
			Me.Close()
		End If
		
	End Sub
	Private Sub vsb_Scroll(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.ScrollEventArgs) Handles vsb.Scroll
		Select Case eventArgs.type
			Case System.Windows.Forms.ScrollEventType.EndScroll
				vsb_Change(eventArgs.newValue)
		End Select
	End Sub
End Class